package com.tmxk.jdbc02.vo;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class SalGradeVO_01 {

    private int grade;
    private int losal;
    private int hisal;

    private int empNo ;
    private String eName;
    private String job;
    private int mgr ;
    // 一般在项目涉及时间类型,通常都定义String类型
    private String hireDate ;
    private double sal ;
    private double comm ;

    public int getGrade() {
        return grade;
    }

    public void setGrade(int grade) {
        this.grade = grade;
    }

    public int getLosal() {
        return losal;
    }

    public void setLosal(int losal) {
        this.losal = losal;
    }

    public int getHisal() {
        return hisal;
    }

    public void setHisal(int hisal) {
        this.hisal = hisal;
    }

    public int getEmpNo() {
        return empNo;
    }

    public void setEmpNo(int empNo) {
        this.empNo = empNo;
    }

    public String geteName() {
        return eName;
    }

    public void seteName(String eName) {
        this.eName = eName;
    }

    public String getJob() {
        return job;
    }

    public void setJob(String job) {
        this.job = job;
    }

    public int getMgr() {
        return mgr;
    }

    public void setMgr(int mgr) {
        this.mgr = mgr;
    }

    public String getHireDate() {
        // 一种方式: 通过Java程序转换时间格式
        SimpleDateFormat sf = new SimpleDateFormat("YYYY-MM-dd HH:mm:ss");
        try {
            Date date = sf.parse(this.hireDate);
            sf = new SimpleDateFormat("yyyy-MM-dd");
            this.hireDate = sf.format(date);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        // 一种方式: 查询sql语句中直接转换
        return hireDate;
    }

    public void setHireDate(String hireDate) {
        this.hireDate = hireDate;
        // 通过set赋值后,调用格式化时间
        this.hireDate = getHireDate();
    }

    public double getSal() {
        return sal;
    }

    public void setSal(double sal) {
        this.sal = sal;
    }

    public double getComm() {
        return comm;
    }

    public void setComm(double comm) {
        this.comm = comm;
    }

    public SalGradeVO_01() {
    }

    public SalGradeVO_01(int grade, int losal, int hisal, int empNo, String eName, String job, int mgr, String hireDate, double sal, double comm) {
        this.grade = grade;
        this.losal = losal;
        this.hisal = hisal;
        this.empNo = empNo;
        this.eName = eName;
        this.job = job;
        this.mgr = mgr;
       // this.hireDate = hireDate;
        this.setHireDate(hireDate);
        this.sal = sal;
        this.comm = comm;
    }

    @Override
    public String toString() {
        return "SalGradeVO{" +
                "grade=" + grade +
                ", losal=" + losal +
                ", hisal=" + hisal +
                ", empNo=" + empNo +
                ", eName='" + eName + '\'' +
                ", job='" + job + '\'' +
                ", mgr=" + mgr +
                ", hireDate='" + hireDate + '\'' +
                ", sal=" + sal +
                ", comm=" + comm +
                '}';
    }
}
